class CalcController < ApplicationController
  def console
  end
  def calc
    @result = calculate
    render :partial => 'result'
  end
  def update
    @result = "#{params[:left]} #{params[:operator]} #{params[:right]} = #{calculate}"
    render :partial => 'update_result'
  end
  def calculate
    if ['+', '-', '*', '/'].include?(params[:operator])		
      return params[:left].to_i.send(params[:operator],params[:right].to_i)
    end
    0
  end
end